<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="../font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
	</head>
	<table id="myTable" border="1">
		<thead>
			<tr>
				<th>第一列</th>
				<th>第二列</th>
				<th>第三列</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>1-1</td>
				<td>1-2</td>
				<td>1-3</td>
			</tr>
			<tr>
				<td>2-1</td>
				<td>2-2</td>
				<td>2-3</td>
			</tr>
			<tr>
				<td>3-1</td>
				<td>3-2</td>
				<td>3-3</td>
			</tr>
		</tbody>
	</table>

	<body>

		<div>
			<i id="dianzan" onclick="dianzan(this)" num="1" class="fa fa-thumbs-o-up fa-4x" aria-hidden="true"></i>
			<span id="qdian" style="display: none;"></span>
		</div>
         <form action="javascript:void(0)" id ="form1">
         	<input type="text" />
         	<input type="text"  />
         	<input type="text" />
         	<button onclick="sss()">重置</button>
         	
         	
         	
         </form> 
         <button onclick="sss()">跳转页面</button>
         <button onclick="prompt('你是gg还是mm','请选择')">获取对话框的值</button>
		<button id="color" onclick="change()">点我</button>

		<div style="background-color: black;width: 200px;height: 200px;" id="myDiv">
			<div style="background-color: gray;width: 100px;height: 100px;" id="minDiv"></div>
		</div>
		<script type="text/javascript"	>
			
		
			var imgnum=document.images.length;
			console.log(imgnum);
			var yuming=document.domain;
			console.log(yuming);
			var num=0;
			changeColor();

			/**
			 * 改变表格颜色
			 */
			function changeColor() {
				var trNum = document.getElementById("myTable").getElementsByTagName("tbody").
				item(0).getElementsByTagName("tr").length;
				for(var i = 0; i < trNum; i++) {
					if((i + 1) % 2 != 0) {
						var tr = document.getElementById("myTable").getElementsByTagName("tbody").
						item(0).getElementsByTagName("tr").item(i);
						tr.style.color = "red";
					}
				}
			}

			/**
			 * 切换div颜色
			 */
			/*var num = 0;
			function change() {
				var colors = ["red", "pink", "yellow", "green", "blue"];
				
				if(num > 4) {
					var myDiv = document.getElementById("myDiv");
					var minDiv = document.getElementById("minDiv");
					num = 0;
					myDiv.style.backgroundColor = colors[num];
					minDiv.style.backgroundColor = colors[num + 1];
					
				} else {
					var myDiv = document.getElementById("myDiv");
					myDiv.style.backgroundColor = colors[num];
					var minDiv = document.getElementById("minDiv");
					minDiv.style.backgroundColor = colors[num + 1];
					num++;
					if(num>4){
						minDiv.style.backgroundColor = colors[0];
					}
				}
			}*/

			var num = 0;

			function change() {
				var colors = ["red", "pink", "yellow", "green", "blue"];
				if(num > 4) {
					num = 0;
					document.getElementById("myDiv").style.backgroundColor = colors[num];
					document.getElementById("minDiv").style.backgroundColor = colors[num + 1];
				} else {
					document.getElementById("myDiv").style.backgroundColor = colors[num];
					if(num == 4) {
						document.getElementById("minDiv").style.backgroundColor = colors[0];
						num = 0;
					} else {
						document.getElementById("minDiv").style.backgroundColor = colors[num + 1];
						num++;
					}

				}
			}

			/**
			 * 点赞功能
			 */
//			function dianzan(obj) {
//				var num = obj.getAttribute("num");
//				if(num % 2 != 0) {
//					num++;
//					//奇数为点赞，变红
//					obj.style.color = "red";
//					obj.setAttribute("num", num);
//				} else {
//					num++;
//					//偶数取消
//					obj.style.color = "black";
//					obj.setAttribute("num", num);
//				}
//			}
	function dianzan(obj) {
				var num = obj.getAttribute("num");
				if(num % 2 != 0) {
					num++;
					obj.style.color = "red";
					obj.setAttribute("num", num);
					document.getElementById("qdian").innerText = "取消点赞";
					document.getElementById("qdian").style.display = "block";
				} else {
					num++
					obj.style.color = "#000000";
					obj.setAttribute("num", num);
					document.getElementById("qdian").style.display = "none";
				}
			}


			function ss() {
				document.getElementById("ts").innerText = "你好";
				document.getElementById("ts").style = "你好";

			}

			function aa() {
				document.getElementById("ts").innerText = "你好坏";
			document.getElementById("ts").style = "你好坏";

			}
			function sss(){
				document.getElementById("form1").reset();
			}
			function sss(){
				confirm("您确定跳转页面？”");
				window.location="../index.html";
			}
			function get(){
				var sex=prompt("你是gg还是mm","请输入你的性别”");
				console.log(sex);
			}
		</script>

	</body>

</html>
